package com.kitty.game.community.controller;

import com.kitty.common.utils.SpringUtils;
import com.kitty.game.community.message.ResqCommunityToken;
import com.kitty.game.npc.service.NewNpcService;
import com.kitty.game.role.model.Role;
import com.kitty.mina.annotation.RequestMapping;
import com.kitty.mina.cache.SessionUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.mina.core.session.IoSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
@Slf4j
public class CommunityController {
    @Autowired
    NewNpcService newNpcService;
    @RequestMapping
    public void openCommunity(IoSession session, ResqCommunityToken resqCommunityToken){
        Role role = SessionUtils.getRoleBySession(session);
//        List<FiedValue> list = new ArrayList<>();
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String a = "\n测试啊#R红色#n测试啊#R红色#n测试啊#R红色#n\nh哈哈哈哈哈哈哈哈哈哈哈哈哈\n哈哈哈哈哈哈哈哈哈哈哈哈";
//        list.add(new FiedValue(2017, 4,simpleDateFormat.format(new Date())+a));
//        RespUpdate respUpdate = new RespUpdate();
//        respUpdate.setRoleId(role.getRoleId());
//        respUpdate.setList(list);
//        MessagePusher.pushMessage(role, respUpdate);
//        RespGeneralNotify respGeneralNotify = new RespGeneralNotify();
//        respGeneralNotify.setNotify((short) NotifyModules.NOTIFY_OPEN_DLG); //关闭对话框
//        respGeneralNotify.setValue("AaaTestDlg");
//        MessagePusher.pushMessage(session, respGeneralNotify);
//        RespNpcContent respNpcContent = new RespNpcContent();
//        respNpcContent.setNpcName("妙音仙子");
//        respNpcContent.setNpcId((int) 972);
//        StringBuilder change = new StringBuilder();
//
//        String content = "元宝回收。[元宝回收贵重宠物/积分回收贵重宠物][销毁贵重物品或宠物/destroy][一键清理背包][离开/离开]";
//        respNpcContent.setContent(content);
//        respNpcContent.setNpcIcon(20072);
//        MessagePusher.pushMessage(role, respNpcContent);


        SpringUtils.getBean(NewNpcService.class).requestNpcContent(role, 15024);
    }

}
